<?php
function p($data){
	echo '<pre>';
	print_r($data);
	echo '</pre>';
}
function __autoload($className){
	if(substr($className, -10)=='Controller' && require_array(
		array(
			MODULE_PATH.'Controller/'.$className.'.class.php',
		)
	)){}else if(substr($className, -5)=='Model' && require_array(
		array(
			MODULE_PATH.'Model/'.$className.'.class.php',
			EASYPHP_PATH."Model.class.php",
		)
	)){}else{
		require EASYPHP_PATH.'Tool/'.$className.'.class.php';
	}
}
//家在加载文件
function require_array($files){
	foreach($files as $f){
		if(is_file($f)){
			require $f;
			return true;
		}
	}
}
//操作配置项
function C($name=null,$value=null){
	static $config=array();
	if(is_null($name)){
		return $config;
	}else if(is_array($name)){
		$config=array_merge($config,$name);
	}else if(is_null($value)){
		return isset($config[$name])?$config[$name]:null;
	}else{
		$config[$name]=$value;
	}
}
//打印用户设定常量
function print_const(){
	$const=get_defined_constants(true);
	p($const);
}
?>